import Vue from 'vue'
import App from './App.vue'
import axios from 'axios';
import router from './router'
import ElementUI from 'element-ui'
import * as echarts from 'echarts';
import 'element-ui/lib/theme-chalk/index.css';
Vue.prototype.$echarts = echarts;
// axios.defaults.baseURL="http://192.168.20.15:8082";
// axios.defaults.baseURL="http://101.43.158.224:8080";
axios.defaults.baseURL="http://localhost:8082";
axios.defaults.withCredentials = true
Vue.prototype.$http = axios;

axios.interceptors.response.use(function (response) {
  // 对响应数据做点什么
  if (405==response.data.code){
    localStorage.removeItem("account");
    console.log(response);
    router.push("/");
  }
  if (response.data.code==403){
    alert("没有权限访问该界面！");
    router.push("/main")
  }
  return response;
});


Vue.use(ElementUI);
Vue.config.productionTip = false
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')